
#import "SMMineMessagesViewController.h"
#import "SMListCardCell.h"
@implementation SMMineMessagesViewController { NSArray *_data; }
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"消息中心";
    self.view.backgroundColor=UIColor.systemGroupedBackgroundColor;
    self.tableView.backgroundColor=UIColor.systemGroupedBackgroundColor;
    self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    [self.tableView registerClass:SMListCardCell.class forCellReuseIdentifier:@"cell"];
    NSMutableArray *arr=[NSMutableArray array];
    for(int i=0;i<20;i++){
        NSString *img=[NSString stringWithFormat:@"https://i.pravatar.cc/100?u=msg_%d", i];
        NSString *title=[NSString stringWithFormat:@"用户%d 发来新消息", i+1];
        NSString *sub=@"您好，请问这批重废还能供货吗？价格是否可谈？";
        NSString *meta=@"2 小时前";
        [arr addObject:@{@"img":img,@"title":title,@"sub":sub,@"meta":meta}];
    }
    _data=arr; [self.tableView reloadData];
}
- (NSInteger)tableView:(UITableView*)t numberOfRowsInSection:(NSInteger)s{ return _data.count; }
- (CGFloat)tableView:(UITableView*)t heightForRowAtIndexPath:(NSIndexPath*)i{ return 96; }
- (UITableViewCell*)tableView:(UITableView*)t cellForRowAtIndexPath:(NSIndexPath*)i{
    SMListCardCell *c=[t dequeueReusableCellWithIdentifier:@"cell" forIndexPath:i];
    NSDictionary *d=_data[i.row];
    [c configureWithImageURL:d[@"img"] title:d[@"title"] subtitle:d[@"sub"] meta:d[@"meta"]];
    return c;
}
@end
